<ui:composition template="/WEB-INF/templates/defaultLayout.xhtml" 
				xmlns="http://www.w3.org/1999/xhtml"
				xmlns:h="http://java.sun.com/jsf/html"
	  			xmlns:p="http://primefaces.org/ui" 
	  			xmlns:f="http://java.sun.com/jsf/core"
      			xmlns:ui="http://java.sun.com/jsf/facelets">

	<ui:define name="title">
		#{Lang.getTrans("ui.mobile.service.title")}
	</ui:define>
	
	<ui:define name="layoutCenter">
		<h:form id="form">
			 
			<p:growl id="growl"/>
			<p:breadCrumb>
				<p:menuitem value="#{lang.getTrans('ui.mobile.common.bread.home')}" url="/home.xhtml"/>
				<p:menuitem value="#{lang.getTrans('ui.mobile.common.bread.service')}" url="/crud/service/serviceList.xhtml"/>
			</p:breadCrumb>
			<p:dataTable id="basic" var="service" value="#{serviceBean.services}" paginator="true" 
				rows="15" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink}
				{LastPageLink} {RowsPerPageDropdown}" >
				
				<p:column id="idService" style="width:14px;" sortBy="#{service.idService}" >				
					<h:outputText value="#{service.idService}"/>	
				</p:column>
				
				<p:column id="idServiceEditDelete" style="width:14px; text-align:center;" >
					<f:facet name="header">	
						<p:commandButton style="width:18px;height:18px;" title="#{lang.getTrans('ui.mobile.common.new')}" 
						icon="ui-icon-circle-plus" action="#{serviceBean.toForm}"/>				
					</f:facet>
					<p:commandButton style="width:18px;height:18px;" title="#{lang.getTrans('ui.mobile.common.delete')}" 
						icon="ui-icon-trash" action="#{serviceBean.remover}" update="@form">  
   						<f:setPropertyActionListener target="#{serviceBean.service}" value="#{service}" />
					</p:commandButton>  
				</p:column>
				
				<p:column style="width:14px;">
					<p:commandButton style="width:18px;height:18px;" title="#{lang.getTrans('ui.mobile.common.edit')}" 
						icon="ui-icon-circle-triangle-e" action="#{serviceBean.toForm()}">  
   						<f:setPropertyActionListener target="#{serviceBean.service}" value="#{service}" />  
					</p:commandButton>  							
				</p:column>

				<p:column style="width:14px;" sortBy="#{service.serviceSituation.cdServiceSituation}">
					<div style="background-color:#{service.serviceSituation.dsPathIcon};width:16px;height:16px;"/>
				</p:column>
				
				<p:column style="width:14px;" sortBy="#{service.serviceType.cdServiceType}">
					<div style="background-color:#{service.serviceType.dsPathIcon};width:16px;height:16px;"/>
				</p:column>
				
				<p:column style="width:14px;">
					<p:commandButton style="width:18px;height:18px;" title="#{lang.getTrans('ui.mobile.common.edit')}" 
						icon="ui-icon-comment" oncomplete="modalAddAnnotationVar.show();">
						<f:setPropertyActionListener target="#{serviceBean.service}" value="#{service}" /> 
					</p:commandButton>  							
				</p:column>
				
				<p:column id="cdService" headerText="#{lang.getTrans('ui.mobile.service.name')}" sortBy="#{service.cdService}" 
					filterBy="#{service.cdService}">				
					<h:outputText value="#{service.cdService}"/>	
				</p:column>

			</p:dataTable>
			
		</h:form>
		<p:dialog id="modalAddAnnotation" modal="true" appendToBody="true"
				widgetVar="modalAddAnnotationVar" width="600" height="400">	
			<h:form>		
				<p:panel id="panel" header="Cadastro de Clientes">
				<h:panelGrid columns="2">
					<h:outputLabel value="Situation" />
					<h:outputLabel value="#{serviceBean.serviceLog.serviceSituation.cdServiceSituation}" />
					
					<h:outputLabel value="Annotation"/>
					<p:inputTextarea id="dsServiceAnnotation" value="#{serviceBean.serviceAnnotation.dsServiceAnnotation}" required="true"
						requiredMessage="#{lang.getTrans('ui.mobile.service.annotation.description.obrigatorio')}"
						cols="70" rows="15" />			
				</h:panelGrid>
				</p:panel>
				
				<h:inputHidden id="idServiceAnnotation" value="#{serviceBean.serviceAnnotation.dsServiceAnnotation}" />
				<h:inputHidden id="nrVersion" value="#{serviceBean.serviceAnnotation.idServiceAnnotation}" />
				
				<p:commandButton id="btSub" value="#{lang.getTrans('ui.mobile.common.save')}"
					action="#{serviceBean.adicionarServiceAnnotation}" type="submit"
					onclick="modalAddAnnotation.hide();" >
					<f:ajax execute="@this" />
				</p:commandButton>
				</h:form>
			</p:dialog>	

	</ui:define>
</ui:composition>